<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
//继承auth登录模型类
use Illuminate\Foundation\Auth\User as AuthUser;

//软删除类
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Role;

//按钮组
use App\Models\Traits\Btn;

class User extends AuthUser
{
    //调用定义的trait类和继承效果一样
    use SoftDeletes,Btn;

    //标识软删除字段
    protected $dates = ['deleted_at'];

    //设置添加字段, create添加数据有效的
    //拒绝不添加字段
    protected $guarded = [];

    //隐藏字段
    protected $hidden = ['password'];


    //用户属于哪个角色 用户和角色之间关系:  属于关系 belongsTo
    public function role(){
        return $this->belongsTo(Role::class,'role_id');
    }


}
